package com.example.demo.demos.filter;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import javax.servlet.*;
import java.io.IOException;

public class MyFilter implements Filter , ApplicationContextAware {

    private static ApplicationContext applicationContext;
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("过滤器启动。。");
        filterChain.doFilter(servletRequest,servletResponse);
        Class<MyFilter> myFilterClass = MyFilter.class;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

}
